'use strict';
module.exports = app => {
  const { TINYINT, INTEGER } = app.Sequelize;

  const NewsArticleCollect = app.model.define('news_article_collect', {

    article_id: {
      type: INTEGER,
      allowNull: false,
      comment: '文章id',
    },
    user_id: {
      type: INTEGER,
      allowNull: false,
      comment: '用户id',
    },
    status: {
      type: TINYINT,
      allowNull: false,
      defaultValue: 1,
      comment: '状态(0:不正常;1:正常;)',
    },

  });

  NewsArticleCollect.associate = () => {
    app.model.NewsArticleCollect.belongsTo(app.model.Article, { as: 'article', foreignKey: 'article_id' });
  };

  return NewsArticleCollect;
};
